<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>医院端发布条件筛选-选择医生</title>
<link rel="shortcut icon" href="${pageContext.request.contextPath }/bootstrapStyle/img/favicon.ico">
<link href="${pageContext.request.contextPath }/bootstrapStyle/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
<link href="${pageContext.request.contextPath }/bootstrapStyle/css/style.min.css?v=4.0.0" rel="stylesheet">
<link href="${pageContext.request.contextPath}/bootstrapStyle/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
<link href="${pageContext.request.contextPath }/bootstrap/css/jquery-confirm.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/bootstrapStyle/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>设置医疗套餐</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="alert alert-info">
                        	 医院自定义的条件筛选，条件上传至服务器，根据算法推荐医生列表，可查看、预约等
                        </div>
                        <form role="form" method="post" class="form-horizontal m-t" action="${pageContext.request.contextPath }/Main/doctor/alldoctorshow.action">
                            <!-- <div class="form-group draggable">
                                <label class="col-sm-1 control-label">套餐名称：</label>
                                <div class="col-sm-6">
                                    <input type="text" name="packagename" id="packagename" value="" minlength="5" maxlength="20" class="form-control" placeholder="" required="" aria-required="true">
                                </div>
                            </div> -->
                            <div class="form-group draggable">
								<label class="col-sm-1 control-label">地区选择*</label>
								<div class="col-sm-2">
									<select class="form-control" name="province_code" id="province_code" required="" aria-required="true" onchange="getMarket()">
								    	<option value="-1">------请选择省------</option>
						    		</select>
                                </div>
                                <div class="col-sm-2">
									<select class="form-control" name="city_code" id="city_code" aria-required="true" onchange="getArea()">
								    	<option value="-1">------请选择市------</option>
						    		</select>
                                </div>
                                <div class="col-sm-2">
									<select class="form-control" name="area_code" id="area_code" aria-required="true">
								    	<option value="-1">------请选择区（县）------</option>
						    		</select>
                                </div>
							</div>
                            <div class="form-group draggable">
								<label class="col-sm-1 control-label">所属医院等级*</label>
								<div class="col-sm-6">
									<select class="form-control" name="hosplevel" id="hosplevel" aria-required="true">
								    	<option value="">------请选择------</option>
						    		</select>
                                </div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-1 control-label">科室选择*</label>
								<div class="col-sm-3">
									<select class="form-control" name="One_level_dept" id="One_level_dept" aria-required="true" onchange="getDept()">
								    	<option value="-1">------请选择一级科室------</option>
						    		</select>
                                </div>
                                <div class="col-sm-3">
									<select class="form-control" name="Two_level_dept" id="Two_level_dept" aria-required="true">
								    	<option value="-1">------请选择二级科室------</option>
						    		</select>
                                </div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-1 control-label">医生职称*</label>
								<div class="col-sm-6">
									<select class="form-control" name="doctortitle" id="doctortitle" aria-required="true">
								    	<option value="">------请选择------</option>
						    		</select>
                                </div>
							</div>
							<div class="form-group draggable">
								<label class="col-sm-1 control-label">坐诊描述*</label>
								<div class="col-sm-6">
									<textarea name="details" id="details" onkeyup="words_deal();" rows="6" minlength="10" maxlength="150" class="form-control" placeholder="请输入单价详情,字数在10-150，可不填写"></textarea>
                                </div>
							</div>
                            <div class="hr-line-dashed"></div>
                            <div class="form-group draggable">
                                <div class="col-sm-12 col-sm-offset-6">
                                    <button class="btn btn-primary" style="width:80px;" type="submit" onclick="btnchange()" id="SavaSubmit">保存</button>
                                    <button class="btn btn-white" style="width:80px;" type="reset">重置</button>
                                </div>
                            </div>
                        </form>
                        <div class="clearfix"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="${pageContext.request.contextPath }/bootstrapStyle/js/jquery.min.js?v=2.1.4"></script>
    <script src="${pageContext.request.contextPath }/bootstrapStyle/js/jquery-1.8.3.min.js"></script>
    <script src="${pageContext.request.contextPath }/bootstrapStyle/js/jquery-confirm.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath }/bootstrapStyle/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
    <script type="text/javascript">
    	$(function () {
    		$.ajax({  //页面首加载省下拉框数据
                type: "post",  
                url: "${pageContext.request.contextPath}/Main/doctor/getProvince.action",
        		async: true,
                data:"cityparentcode=0",
                success: function (data) {
                	var datalist = data.list;
                    for (var i = 0; i < datalist.length; i++) {  
                        $('#province_code').append("<option value='" + datalist[i].citycode + "' >" + datalist[i].cityname + "</option>");  
                    }  
                },  
                error: function () {  
                    $.alert("加载省失败!!!");  
                }  
            });
    		
    		$.ajax({  //页面首加载一级部门下拉框数据
                type: "post",  
                url: "${pageContext.request.contextPath}/Main/doctor/getHospitalDept.action",
        		async: true,
                data:"hospdeptfatherid=0",
                success: function (data) {
                	var datalist=data.list;
                    for (var i = 0; i < datalist.length; i++) {  
                        $('#One_level_dept').append("<option value='" + datalist[i].hospdeptid + "' >" + datalist[i].hospdeptname + "</option>");  
                    }  
                },  
                error: function () {  
                    $.alert("加载一级部门失败!!!");  
                }  
            });
    	
    		$.ajax({  //页面首加载医院等级下拉框数据
                type: "post",  
                url: "${pageContext.request.contextPath}/Main/doctor/getHospitalLevel.action",
        		async: true,
                success: function (data) {
                	var datalist = data.list;
                    for (var i = 0; i < datalist.length; i++) {  
                        $('#hosplevel').append("<option value='" + datalist[i].hosplevelname + "' >" + datalist[i].hosplevelname + "</option>");  
                    }  
                },  
                error: function () {  
                    $.alert("加载一级部门失败!!!");  
                }  
            });
    		
    		$.ajax({  //页面首加载医生职称下拉框数据
                type: "post",  
                url: "${pageContext.request.contextPath}/Main/doctor/getDoctorTitle.action",
        		async: true,
                success: function (data) {
                	var datalist =data.list;
                    for (var i = 0; i < datalist.length; i++) {  
                        $('#doctortitle').append("<option value='" + datalist[i].doctitlename + "' >" + datalist[i].doctitlename + "</option>");  
                    }  
                },  
                error: function () {  
                    $.alert("加载一级部门失败!!!");  
                }  
            });
		});
    	
    	/* function btnchange(){
    		$("#SavaSubmit").html('<i class="fa fa-spinner fa-spin"></i>处理中...');
    		$("#SavaSubmit").prop('disabled',true);
    	} */
    	function getDept(){
    		var One_level_dept = $("#One_level_dept").val();
    		if(One_level_dept==-1){
                $("#Two_level_dept").empty();
                $('#Two_level_dept').append("<option value='-1' selected='selected' >" + '------请选择二级科室------' + "</option>");  
    		}else{
    			$("#Two_level_dept").empty();
    			$.ajax({  //页面首加载一级部门下拉框数据
                    type: "post",  
                    url: "${pageContext.request.contextPath}/Main/doctor/getHospitalDept.action",
            		async: true,
                    data:"hospdeptfatherid="+One_level_dept,
                    success: function (data) {
                    	var datalist = data.list;
                        $('#Two_level_dept').append("<option value='-1' selected='selected' >" + '------请选择二级科室------' + "</option>");  
                        for (var i = 0; i < datalist.length; i++) {  
                            $('#Two_level_dept').append("<option value='" + datalist[i].hospdeptid + "' >" + datalist[i].hospdeptname + "</option>");  
                        }  
                    },  
                    error: function () {  
                        $.alert("加载一级部门失败!!!");  
                    }  
                });
    		}
    	}
    	
    	function getMarket(){
    		var cityparentcode = $("#province_code").val();
    		if(cityparentcode==-1){
    			$("#city_code").empty();  
                $("#area_code").empty();
                $('#city_code').append("<option value='-1' selected='selected' >" + '------请选择市------' + "</option>");  
                $('#area_code').append("<option value='-1' selected='selected' >" + '------请选择区（县）------' + "</option>");  
    		}else{
    			$("#city_code").empty();  
                $("#area_code").empty();
                $.ajax({  //页面首加载省下拉框数据
                    type: "post",  
                    url: "${pageContext.request.contextPath}/Main/doctor/getProvince.action",
            		async: true,
                    data:"cityparentcode="+cityparentcode,
                    success: function (data) {
                    	var datalist = data.list;
                    	$('#city_code').append("<option value='-1' selected='selected' >" + '------请选择市------' + "</option>");  
                        $('#area_code').append("<option value='-1' selected='selected' >" + '------请选择区（县）------' + "</option>");  
                        for (var i = 0; i < datalist.length; i++) {
                            $('#city_code').append("<option value='" + datalist[i].citycode + "' >" + datalist[i].cityname + "</option>");  
                        }  
                    },  
                    error: function () {  
                        $.alert("加载市失败!!!");  
                    }  
                });
    		}
    	}
    	function getArea(){
    		var cityparentcode = $("#city_code").val();
    		if(cityparentcode==-1){
    			$("#area_code").empty();
    			$('#area_code').append("<option value='-1' selected='selected' >" + '------请选择区（县）------' + "</option>");  
    		}else{
    			$("#area_code").empty();
        		$.ajax({  //页面首加载省下拉框数据
                    type: "post",  
                    url: "${pageContext.request.contextPath}/Main/doctor/getProvince.action",
            		async: true,
                    data:"cityparentcode="+cityparentcode,
                    success: function (data) {
                    	var datalist = data.list;
                        $('#area_code').append("<option value='-1' selected='selected' >" + '------请选择区（县）------' + "</option>");  
                        for (var i = 0; i < datalist.length; i++) {
                            $('#area_code').append("<option value='" + datalist[i].citycode + "' >" + datalist[i].cityname + "</option>");  
                        }  
                    },  
                    error: function () {  
                        $.alert("加载区（县）失败!!!");  
                    }  
                });
    		}
    	}
    	function words_deal(){
        	var details=$('#details').val().length;
	        if(details>150){
	        	var num=$("#details").val().substr(0,150);
	        	$("#details").val(num);
	        	//alert("超过字数限制，多出的字将被截断！" );
	        }
        }
    </script>
</body>
</html>